#ifndef _M_LOGGER_H_
#define _M_LOGGER_H_
#include<stdio.h>
#include<time.h>

//正常
#define INF 0
//调试信息
#define DBG 1
//错误信息
#define ERR 2

//strftime:将时间转换为指定格式的字符串
#define LOG(level,format,...) do{\
    time_t t = time(NULL);\
    struct tm *lt = localtime(&t);\
    char buf[32];\
    strftime(buf,21,"%H:%M:%S",lt);\
    fprintf(stdout,"[%s %s:%d] " format "\n",buf,__FILE__,__LINE__,##__VA_ARGS__);\
}while(0)

#define ILOG(format,...) LOG(INF,format,##__VA_ARGS__);
#define DLOG(format,...) LOG(DBG,format,##__VA_ARGS__);
#define ELOG(format,...) LOG(ERR,format,##__VA_ARGS__);

#endif
